# 字符串反转 的 两种方法
a = '12345'
b = ''
for i in a[::-1]:
    b += i
print(b)

a = '12345'
b = list(a)
b.reverse()
b = ''.join(b)
print(b)
c = 4
d = 5
r = (c + d) // 2
print(r)

# 二分法求1024的位置
data = [1, 3, 6, 13, 56, 123, 345, 1024, 3223, 6688]


def find(lst, n, head, tail):
    mid = (head + tail) // 2
    print('m:', mid)
    if lst[mid] < n:
        find(lst, n, mid, tail)
    elif lst[mid] > n:
        find(lst, n, head, mid)
    else:
        print(mid)

